package util;

import java.net.UnknownHostException;

import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.MongoClient;
import com.mongodb.ServerAddress;

public class DBUtil {

	public static DB getDB(String db) throws UnknownHostException {
		MongoClient mongoClient = new MongoClient(new ServerAddress("localhost", 27017));
		return mongoClient.getDB(db);
	}
	
	public static DBCollection getCollection(String db, String collection) throws UnknownHostException {
		return getDB(db).getCollection(collection);
	}
	
}
